This test ensures that exceptions are handled correctly by the various callback mechanisms present in WebCore.
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var db = openDatabase("exception-info-test", "1.0", "Test for exception information thrown by callbacks and timers", 1);

function errorObject(msg) {
    return { message: "FAIL: message incorrectly pulled from thrown object in " + msg, 
             toString: function() {return "PASS: toString called on exception value thrown from " + msg} }
}

function eventTest() {
    setTimeout(dbTransactionTest, 0);
    throw errorObject("event handler");
}

function dbTransactionTest() {
    db.transaction(function(tx) { 
        setTimeout(dbStatementTest, 0);
        throw errorObject("sql transaction callback");
    });
}

function dbStatementTest() {
    db.transaction(
        function(tx) {
            tx.executeSql("I am bogus syntax", [], function() {
        }, function(tx, error) {
            setTimeout(timerTest, 0);
            throw errorObject("sql error callback");
        });
    });
}

function timerTest() {
    if (window.testRunner)
        setTimeout("testRunner.notifyDone()", 0);
    throw errorObject("timer");
}

window.onload = eventTest;
</script>

